home *** CD-ROM | disk | FTP | other *** search
- // TestProject for Windows application
- //
-
- Use DfAllent.pkg
- Object oHtmlHelp is a cHtmlHelp
- End_Object
-
- Object oApplication is a cApplication
- Set pbPreserveEnvironment to False
- Set peHelpType to htHtmlHelp
- End_Object // oApplication
-
- Object oMain is a Panel
-
- Property Handle phoViewMenu 0
- Property Handle phoReportMenu 0
-
- Set Label To "My Project"
- Set Location to 4 30
- Set Size to 300 400
-
-
- DFCreate_Menu Main_Menu
- #INCLUDE File_pm.inc
-
- DFCreate_Menu "&View" ViewPopupMenu is a ViewPopupMenu
- Set phoViewMenu to self // Setting this in the panel is used for test view auto-activation
- End_Pull_Down
-
- Set Status_Help To "Available Views"
-
- DFCreate_Menu "&Report" ReportPopupMenu is a ViewPopupMenu
- Set phoReportMenu to self // Setting this in the panel is used for test view auto-activation
- End_Pull_Down
-
- Set Status_Help To "Available Reports"
-
- #INCLUDE Navi_pm.inc
- #INCLUDE Win_pm.inc
- #INCLUDE Helpa_pm.inc
- End_Menu // Main_Menu
-
-
- Use DefaultToolbar.pkg // Tool-Bar object.
-
- Object oClientArea is a ClientArea
-
- Use Dd_debug.dg // This Provides access to dd debugger by pressing ctrl+d within any view. Good for debugging
-
- End_Object // oClientArea
-
- Use DefaultStatusbar.pkg // Status-Bar object.
-
- Use StdAbout.pkg
-
- Procedure Activate_About
- Send DoAbout "Test Windows Projects" "0.0.0" "" "" ""
- End_Procedure
-
- //
- // All of the code below are methods and augmentations which makes this work well as a test program. This:
- // 1. Supports an auto-activate feature where all dialogs in the view and report menu are activated upon startup
- // 2. forces the panel to resize if it is not large enough to accomodate all of the views.
- // This code was placed directly in the testproject template and, therefore, directly in the .src file so
- // a developer can easily modify this to fit their own needs. It is not expected that these techniques would
- // get used in actual deployed projects.
- //
-
- // special test component code to activate all views and reports. For testing we assume
- // that you want to see everything.
-
- Procedure AutoActivate
- handle hoMenu
- Integer iItems i
-
- // this activates all views from the view menu
- Get phoViewMenu to hoMenu
- If hoMenu begin
- Get Item_count of hoMenu to iItems
- For i from 0 to (iItems-1)
- Set Current_Item of hoMenu to i
- Send Redirect_Message of hoMenu
- Loop
- end
-
- // this activates all views from the report view menu
- Get phoReportMenu to hoMenu
- If hoMenu begin
- Get Item_count of hoMenu to iItems
- For i from 0 to (iItems-1)
- Set Current_Item of hoMenu to i
- Send Redirect_Message of hoMenu
- Loop
- end
- End_Procedure
-
-
- // This checks all views within the client area to make sure that they fit within
- // the client area. If not we will adjust the main panel so everything fits. This
- // can only be done after the objects are all activated.
-
- Procedure MakeGoodPanelSize
- Handle hoView hoClient
- Integer iSize iLoc iHeight iWidth iOldSize
- Get Client_Id to hoClient
- If hoClient begin
- Get GuiSize of hoClient to iOldSize // starting size of client area
- Move (Hi(iOldSize)) to iHeight
- Move (Low(iOldSize)) to iWidth
- // for each mdi client see if it fits, keep track of largest size needed
- Get Next_Mdi_Dialog of hoClient True to hoView // find first
- While (hoView)
- Get GuiSize of hoView to iSize // size of view
- Get GuiLocation of hoView to iLoc // location of view
- Move (hi(iSize)+hi(iLoc)+10 max iHeight) to iHeight // max height needed (+10 is for wiggle room)
- Move (low(iSize)+low(iLoc)+10 max iWidth) to iWidth // max width needed
- Get Next_Mdi_Dialog of hoClient False to hoView // find next view
- Loop
- Move (iHeight-hi(iOldSize) max 0) to iHeight // get delta compared to old size. We want delta
- Move (iWidth-low(iOldSize) max 0) to iWidth // only if the new size is bigger (i.e., > 0)
- If (iHeight>0 or iWidth>0) begin
- Get GuiSize to iOldSize // now add the delta to the panel size
- Set GuiSize to (hi(iOldSize)+iHeight) (low(iOldSize)+iWidth)
- Send Adjust_Logicals // adjust from gui to regular size
- end
- end
- End_Procedure
-
- // special test program augmentation which opens all views and report views and
- // makes sure that the size of the panel is big enough
-
- Procedure End_Construct_Object
- Boolean bAutoActivate
- Get Auto_Activate_State to bAutoActivate
- Forward send End_Construct_Object
- If bAutoActivate begin
- Send AutoActivate // activate all views and report views
- send MakeGoodPanelSize // make sure the panel is big enough for all of this
- end
- End_Procedure
-
- End_Object // oMain
-
- Start_UI
-
-